import java.util.Arrays;
import java.util.Scanner;

public class Text2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();//平均数值

        int[] arr = new int[n];
        int ret = 0;
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }

        for (int i = 0; i < n; i++) {
            int tmp = 0;
            for (int j = i, z = 1; j < n; j++){
                tmp += arr[j];
                if (tmp > z * m){
                    ret++;
                }
                z++;
            }
        }

        System.out.println(ret % 10000007);

    }
}
